package com.aididi.repository.mysql;

import com.aididi.dto.LogDto;
import com.aididi.entity.mysql.MysqlLog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @Auther: zx.xu
 * @Description:
 */
public interface LogRepository extends JpaRepository<MysqlLog,Integer> {
/*

    @Query("select e from MysqlLog e order by e.createTime desc")
    List<MysqlLog> queryAll(PageRequest pageRequest);
*/

    @Query("select e from MysqlLog e where e.name like concat('%',:keyword,'%') " +
            "or e.desc like concat('%',:keyword,'%') order by e.createTime desc ")
    List<MysqlLog> queryList(@Param("keyword") String keyword);

}
